<template>
	<view>
		<view class="hidden"
			style="background: url(../../static/my/mine-bg.png) left top / 100% 100% no-repeat;height: 800rpx;">
			<view :style="{height:statusbar+'px'}"></view>
			<view style="margin-top: 200rpx;margin-bottom: 80rpx;" class="flex flex-y-center pl-30 pr-30">
				<view
					style="width: 120rpx;height: 120rpx;border-radius: 50%;background-color: #FFFFFF;overflow: hidden;">
					<qq-image :url="user_info.avatarUrl" style="width: 100%;height: 100%;"></qq-image>
				</view>

				<view @tap.stop="toPage('/pages/login/login')" class="fs-36 color-333333 bold ml-30 flex-1"
					v-if="!user_info.id">登录</view>
				<view v-else class="flex-1 over-line1 pl-30" @tap.stop="toPage1()">
					<view class="fs-36 color-ffffff bold" style="line-height: 34rpx;">{{user_info.name}}</view>
					<view class="fs-26 color-ffffff mt-10 over-line1">签名:{{user_info.signature || '未设置'}}</view>
				</view>

				<image @tap.stop="toPage('/pages/user/invite')" src="../../static/my/code.png"
					style="width: 36rpx;height: 36rpx;z-index: 99999;;"></image>
			</view>

			<!-- vip -->
			<!-- <view style="height: 30rpx;" v-if="!ios_show"></view>
			<view v-else>
				<vip-box></vip-box>
			</view> -->
			<!-- vip -->

		</view>
		<!-- ios审核 -->
		<!-- <view v-if="!ios_show"></view>
		<view v-else>
			<partnerpages></partnerpages>
		</view> -->

		<view>
			<partnerpages></partnerpages>
		</view>

		<view class="bgmineicon"></view>
		<view class="flex">
			<view class="flex-content">
				<!--ios审核  -->
				<!-- <view class="flex-content" :style="{ marginTop: !ios_show ? '-380rpx' : '20rpx' }"> -->

				<!-- 课程 -->
				<!-- <view class="flex mt-20 flex-x-b" v-if="ios_show">
					<view class="pr" style="width:333rpx;height:121rpx;" @tap.stop="toPage('/pages/course/course')">
						<image style="width:100%;height:100%;" src="../../static/my/user-course01.png"></image>
						<view class="course-text">我的课程</view>
					</view>
					<view class="pr" style="width:333rpx;height:121rpx;"
						@tap.stop="toPage('/pages/course/mybuyCourse')">
						<image style="width:100%;height:100%;" src="../../static/my/user-course02.png"></image>
						<view style="color: #313B67;" class="course-text">已购课程</view>
					</view>
				</view> -->
				<!-- 课程 -->


				<!-- 我的订单 -->
				<!-- 	<view @tap.stop="toPage('/pages/goods/order','',true)" class="mt-20"
					style="background-color: rgba(255,255,255,1);border-radius: 30rpx;padding: 0 30rpx;">
					<view class="flex flex-x-b flex-y-end" style="padding-top: 30rpx;">
						<view class="fs-28 color-333333 bold">
							我的订单
						</view>
						<view class="flex flex-x-y color-999999">
							<view class="fs-28">全部订单</view>
							<view class="iconfont icon-jinru w-20 bold fs-30"></view>
						</view>
					</view>
					<view class="color-ffffff flex flex-x-b">
						<view class="orderItem" style="width:20%;"
							@tap.stop="toPage('/pages/goods/order?index=1','',true)">
							<image class="" src="../../static/goods/o1.png"></image>
							<view class="">待付款</view>
						</view>
						<view class="orderItem" style="width:20%;"
							@tap.stop="toPage('/pages/goods/order?index=2','',true)">
							<image class="" src="../../static/goods/o2.png">
							</image>
							<view class="">待发货</view>
						</view>
						<view class="orderItem" style="width:20%;"
							@tap.stop="toPage('/pages/goods/order?index=3','',true)">
							<image class="" src="../../static/goods/o3.png"></image>
							<view class="">待收货</view>
						</view>

						<view class="orderItem" style="width:20%;"
							@tap.stop="toPage('/pages/goods/order?index=4','',true)">
							<image class="" src="../../static/goods/o5.png"></image>
							<view class="">已取消</view>
						</view>
					</view>
				</view> -->
				<!-- 我的订单 -->




				<!-- 更多功能 -->
				<view class="bg-FFFFFF mt-20" style="border-radius: 30rpx;padding: 30rpx 0 4rpx 0;">
					<view class="fs-28 color-333333 bold pl-30">
						更多功能
					</view>
					<view class="flex flex-wrap" style="margin-top: 37rpx;">
						<view hover-class="click1" hover-start-time="10" v-if="item.show !== false" class="my-item-box"
							@tap.stop="toPage(item.url)" v-for="(item,index) in itemArr" :key="index">


							<view class="my-item-image-box">
								<image :src="item.src"></image>
							</view>
							<view v-if="item.name == '我的动态' && ReadCount !== 0" style="background-color: red;width: 10rpx;height: 10rpx;
							border-radius: 50%;position: absolute;top: 40rpx;left: 110rpx;"></view>
							<view class="my-item-text">{{item.name}}</view>
						</view>
					</view>
				</view>
				<!-- 更多功能 -->


			</view>
		</view>
















		<!-- <view class="vip" v-if="ios_show" @tap.stop="toPage('/pages/user/vip','',true)" style="line-height: 36rpx;">
			<view class="left">
				<image src="../../static/my/vip.png" style="width: 50rpx" mode="widthFix"></image>
				<view class="mt-10 fs-26">发个信VIP</view>
			</view>
			<view class="line"></view>
			<view class="center" v-if="!user_info.VIP">
				<view class="fs-24">好友受限 升级VIP</view>
				<view class="mt-8 white fs-24">办理会员可享超多VIP权益</view>
			</view>
			<view class="center" v-else>
				<view class="fs-24">已开通 {{user_info.VIP}}</view>
				<view class="mt-8 white fs-24">到期时间：{{user_info.vip_end_time}}</view>
			</view>
			<view class="right">{{ btnText }}</view>
		</view>
 -->



		<view style="height: 20rpx;"></view>
		<fixed-line></fixed-line>
		<common></common>
		<powers1 ref="powers1" type="top" @changeAuth="changeAuth" :permissionID="permissionID"></powers1>

	</view>
</template>

<script>
	import powers1 from '@/components/powers/powers1.vue'
	import avater from "../../components/avater/avater.vue";
	import settingItem from "../../components/setting-item/setting-item.vue";
	import partnerpages from "./partnerpages";
	export default {

		components: {
			settingItem,
			avater,
			partnerpages,
			powers1
		},
		data() {
			return {
				permissionID: '',
				userinfo: {},
				statusbar: getApp().globalData.statusBar,
				pay_code: "",
				shop_info: {
					acticityNum: "0",
					followNum: "0",
					likes: "0",
				},
				coupon: "", //核销优惠券id
				itemArr: [],
				ReadCount: 0,
			};
		},
		computed: {
			btnText() {
				return this.user_info.vip === 0 ? '去开通' : '查看权益'
			}
		},
		onLoad() {
			const {
				avatarUrl,
				fullName,
				signature,
				name,
				phone,
				vip,
				vipEndTime
			} = this.user_info
			this.userinfo = {
				avatarUrl: avatarUrl || '../../static/images/rentou.png',
				name: name || fullName || phone,
				signature: signature || '未设置签名',
				vip,
				vipEndTime
			};
			this.initItem();

		},
		onShow() {
			this.$store.dispatch('refresh_user');
			this.login();
			this.initItem();
			this.getunReadCount()
		},
		methods: {
			toPage1() {
				if (uni.getSystemInfoSync().platform == 'ios') {
					this.toPage('/pages/user/userinfo-edit')

				} else {
					this.permissionID = "CAMERA";
					setTimeout(() => {
						this.$refs['powers1'].open();
					}, 500)
				}
			},
			changeAuth() {
				this.toPage('/pages/user/userinfo-edit')
				//这里是权限通过后执行自己的代码逻辑
				console.log('权限已授权，可执行自己的代码逻辑了');
			},

			getunReadCount() {
				this.request({
					url: '/friendCircleNotice/unReadCount',
				}).then(res => {
					if (!this.rsuccess(res)) return;
					this.ReadCount = res.data

				});
			},
			initItem() {
				//oppo审核，青少年模式下隐私的模块
				// let teenagemodeif = uni.getStorageSync('teenagemodeif') 
				// if(teenagemodeif == true){
				// 	this.itemArr = [
				// 		{
				// 			name: '我的动态',
				// 			url: '/pages/dynamics/dynamics',
				// 			src: '../../static/my/my-friend.png'
				// 		},
				// 		{
				// 			name: '我的信友圈',
				// 			url: '/pages/friend/frienduser',
				// 			src: '../../static/my/my-friend.png'
				// 		},
				// 		{
				// 			name: '我的收藏',
				// 			url: '/pages/user/collect',
				// 			src: '../../static/my/collect.png'
				// 		},
				// 		{
				// 			name: '在线客服',
				// 			url: '/pages/chat/server',
				// 			src: '../../static/my/server.png'
				// 		},
				// 		{
				// 			name: '系统设置',
				// 			url: '/pages/setting/setting',
				// 			src: '../../static/my/setting.png'
				// 		},
				// 		{
				// 			name: '关于我们',
				// 			url: '/pages/user/aboutUs',
				// 			src: '../../static/my/about.png'
				// 		},
				// 	];
				// }else{
				// 	if (this.user_info.partnerEndTime) {
				// 		this.itemArr = [
				// 			{
				// 				name: '我的收益',
				// 				url: '/pages/course/income',
				// 				src: '../../static/my/money.png',
				// 				show: this.ios_show,
				// 			},
				// 			{
				// 				name: '分红池',
				// 				url: '/pages/course/dividendpool',
				// 				src: '../../static/my/dividendpool_icon.png',
				// 				show: this.ios_show,
				// 			},
				// 			{
				// 				name: '我的动态',
				// 				url: '/pages/dynamics/dynamics',
				// 				src: '../../static/my/my-friend.png'
				// 			},
				// 			{
				// 				name: '我的收藏',
				// 				url: '/pages/user/collect',
				// 				src: '../../static/my/collect.png'
				// 			},
				// 			{
				// 				name: '邀请好友',
				// 				url: '/pages/user/invite',
				// 				src: '../../static/my/share.png'
				// 			},
				// 			{
				// 				name: '我的信友圈',
				// 				url: '/pages/friend/frienduser',
				// 				src: '../../static/my/my-friend.png'
				// 			},

				// 			{
				// 				name: '在线客服',
				// 				url: '/pages/chat/server',
				// 				src: '../../static/my/server.png'
				// 			},
				// 			{
				// 				name: '系统设置',
				// 				url: '/pages/setting/setting',
				// 				src: '../../static/my/setting.png'
				// 			},
				// 			{
				// 				name: '实名认证',
				// 				url: '/pages/user/truename',
				// 				src: '../../static/my/truename.png'
				// 			},
				// 			{
				// 				name: '关于我们',
				// 				url: '/pages/user/aboutUs',
				// 				src: '../../static/my/about.png'
				// 			},
				// 			{
				// 				name: '我的团队',
				// 				url: '/pages/user/team',
				// 				src: '../../static/my/team2.png',
				// 				show: this.ios_show,
				// 			},
				// 		];
				// 	} else {
				// 		this.itemArr = [
				// 			{
				// 				name: '我的收益',
				// 				url: '/pages/course/income',
				// 				src: '../../static/my/money.png',
				// 				show: this.ios_show,
				// 			},
				// 			{
				// 				name: '我的动态',
				// 				url: '/pages/dynamics/dynamics',
				// 				src: '../../static/my/my-friend.png'
				// 			},
				// 			{
				// 				name: '我的收藏',
				// 				url: '/pages/user/collect',
				// 				src: '../../static/my/collect.png'
				// 			},
				// 			{
				// 				name: '邀请好友',
				// 				url: '/pages/user/invite',
				// 				src: '../../static/my/share.png'
				// 			},
				// 			{
				// 				name: '我的信友圈',
				// 				url: '/pages/friend/frienduser',
				// 				src: '../../static/my/my-friend.png'
				// 			},

				// 			{
				// 				name: '在线客服',
				// 				url: '/pages/chat/server',
				// 				src: '../../static/my/server.png'
				// 			},
				// 			{
				// 				name: '系统设置',
				// 				url: '/pages/setting/setting',
				// 				src: '../../static/my/setting.png'
				// 			},
				// 			{
				// 				name: '实名认证',
				// 				url: '/pages/user/truename',
				// 				src: '../../static/my/truename.png'
				// 			},
				// 			{
				// 				name: '关于我们',
				// 				url: '/pages/user/aboutUs',
				// 				src: '../../static/my/about.png'
				// 			},
				// 			{
				// 				name: '我的团队',
				// 				url: '/pages/user/team',
				// 				src: '../../static/my/team2.png',
				// 				show: this.ios_show,
				// 			},
				// 		];
				// 	}
				// }


				if (this.user_info.partnerEndTime) {
					this.itemArr = [{
							name: '我的收益',
							url: '/pages/course/income',
							src: '../../static/my/money.png',
							show: this.ios_show,
						},
						{
							name: '分红池',
							url: '/pages/course/dividendpool',
							src: '../../static/my/dividendpool_icon.png',
							show: this.ios_show,
						},
						{
							name: '我的动态',
							url: '/pages/dynamics/dynamics',
							src: '../../static/my/my-friend.png'
						},
						{
							name: '我的收藏',
							url: '/pages/user/collect',
							src: '../../static/my/collect.png'
						},
						{
							name: '邀请好友',
							url: '/pages/user/invite',
							src: '../../static/my/share.png'
						},
						{
							name: '我的信友圈',
							url: '/pages/friend/frienduser',
							src: '../../static/my/my-friend.png'
						},

						{
							name: '在线客服',
							url: '/pages/chat/server',
							src: '../../static/my/server.png'
						},
						{
							name: '系统设置',
							url: '/pages/setting/setting',
							src: '../../static/my/setting.png'
						},
						{
							name: '实名认证',
							url: '/pages/user/truename',
							src: '../../static/my/truename.png'
						},
						{
							name: '关于我们',
							url: '/pages/user/aboutUs',
							src: '../../static/my/about.png'
						},
						{
							name: '我的团队',
							url: '/pages/user/team',
							src: '../../static/my/team2.png',
							show: this.ios_show,
						},
					];
				} else {
					this.itemArr = [{
							name: '我的收益',
							url: '/pages/course/income',
							src: '../../static/my/money.png',
							show: this.ios_show,
						},
						{
							name: '我的动态',
							url: '/pages/dynamics/dynamics',
							src: '../../static/my/my-friend.png'
						},
						{
							name: '我的收藏',
							url: '/pages/user/collect',
							src: '../../static/my/collect.png'
						},
						{
							name: '邀请好友',
							url: '/pages/user/invite',
							src: '../../static/my/share.png'
						},
						{
							name: '我的信友圈',
							url: '/pages/friend/frienduser',
							src: '../../static/my/my-friend.png'
						},

						{
							name: '在线客服',
							url: '/pages/chat/server',
							src: '../../static/my/server.png'
						},
						{
							name: '系统设置',
							url: '/pages/setting/setting',
							src: '../../static/my/setting.png'
						},
						{
							name: '实名认证',
							url: '/pages/user/truename',
							src: '../../static/my/truename.png'
						},
						{
							name: '关于我们',
							url: '/pages/user/aboutUs',
							src: '../../static/my/about.png'
						},
						{
							name: '我的团队',
							url: '/pages/user/team',
							src: '../../static/my/team2.png',
							show: this.ios_show,
						},
					];
				}

			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: $pageColor;

	}

	.bgmineicon {
		position: fixed;
		top: 60rpx;
		right: -80rpx;
		width: 350rpx;
		height: 350rpx;
		background: url(../../static/my/minebg-icon.png) center center no-repeat;
		background-size: 350rpx;
	}

	.course-text {
		position: absolute;
		left: 30rpx;
		font-size: 30rpx;
		font-weight: bold;
		top: 46rpx;
		line-height: 34rpx;
	}

	.my-item-box {
		position: relative;
		width: 25%;
		display: flex;
		flex-flow: column nowrap;
		margin-bottom: 46rpx;
		justify-content: center;
		align-items: center;

		.my-item-image-box {
			width: 46rpx;
			height: 46rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.my-item-text {
			font-size: 26rpx;
			color: #666666;
			line-height: 28rpx;
			margin-top: 20rpx;
		}

	}

	.my-item-click {
		background-color: rgba(0, 0, 0, 0.1);
	}


	.orderItem {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 25%;
		margin-bottom: 40rpx;
		margin-top: 40rpx;

		image {
			width: 50rpx;
			min-width: 50rpx;
			height: 50rpx;
			margin-bottom: 20rpx;
			transform: scale(1.1);
		}

		view {
			font-size: 26rpx;
			text-align: left;
			color: #333;
			line-height: 26rpx;
		}
	}
</style>